19. Finding all primes: Finding All Primes Up to a Given Bound
Description
The function primes displays a vector with all prime numbers up to a given bound. Computation can be made by using different probabilistic primality tests at the user's choice (Fermat Test, Miller-Rabin Test or Solovay-Strassen Test). The number of iterations is also configurable, to set the desired accuracy.
Usage
primes(n, test = "MR", iter = 10, bar = TRUE)
# S3 method for default
primes(n, test = "MR", iter = 10, bar = TRUE)
# S3 method for numeric
primes(n, test = "MR", iter = 10, bar = TRUE)
# S3 method for vli
primes(n, test = "MR", iter = 10, bar = TRUE)
Value
vector of objects of class "noquote"
Arguments
n
upper bound of the interval in which look for primes; object of class vli or 32 bits
test
chosen test for each number: "F" for the Fermat Test, "SS" for the Solovay-Strassen Test or "MR" (by default) for the Miller-Rabin Test; character
iter
number of iterations for each number being tested; numeric
bar
to choose if display or not a progress bar; boolean